package com.example.aidl.bean;

import android.os.Parcel;
import android.os.Parcelable;

public class Person implements Parcelable {
    private String mName;
    private String mAge;
    public Person(String name) {
        mName = name;
        mAge = name;
    }

    protected Person(Parcel in) {
        mName = in.readString();
        mAge = in.readString();
    }

    public static final Creator<Person> CREATOR = new Creator<Person>() {
        @Override
        public Person createFromParcel(Parcel in) {
            return new Person(in);
        }

        @Override
        public Person[] newArray(int size) {
            return new Person[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }
   //将对象信息写入
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(mName);
        dest.writeString(mAge);
    }

    @Override
    public String toString() {
        return "\nPerson{" +
                "mName='" + mName + '\'' +"    age=="+mAge+'\''+
                '}';
    }

}
